//
//  ImageNewsCell.swift
//  MyTest
//
//  Created by guanzhongwang on 2021/5/9.
//

import UIKit

class BigImageNewsCell: BaseTableViewCell {
    private let titleLabel = UILabel()
    let bottomView = NewsCellBottomView()
    let showImage = UIImageView()
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        contentView.addSubview(showImage)
        showImage.backgroundColor = .red
      
        contentView.addSubview(titleLabel)
        titleLabel.font = Font_Size_14
        titleLabel.numberOfLines = 2
        titleLabel.snp.makeConstraints({
            $0.left.top.equalTo(15)
            $0.right.equalToSuperview().inset(15)
        })
        showImage.snp.makeConstraints({
            $0.top.equalTo(titleLabel.snp.bottom).offset(10)
            $0.left.right.equalTo(titleLabel)
            $0.height.equalTo(100).priority(.high)
        })
        contentView.addSubview(bottomView)
        bottomView.snp.makeConstraints({
            $0.bottom.equalToSuperview()
            $0.top.equalTo(showImage.snp.bottom)
            $0.left.right.equalTo(titleLabel)
        })
    }
    func bind(item:NewsModel) {
        titleLabel.text = item.title
        bottomView.updateContent(item: item)
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
